<?php

use yii\widgets\ActiveForm;
use common\helpers\Url;
use common\enums\StatusEnum;
use common\helpers\ArrayHelper;

$form = ActiveForm::begin([
    'id' => $model->formName(),
    'enableAjaxValidation' => true,
    'validationUrl' => Url::to(['ajax-edit', 'id' => $model['id']]),
    'fieldConfig' => [
        'template' => "<div class='col-sm-2 text-right'>{label}</div><div class='col-sm-10'>{input}\n{hint}\n{error}</div>",
    ]
]);
?>
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">×</span>
        </button>
        <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">基本信息</a></li>
            <li><a data-toggle="tab" href="#tab-2" aria-expanded="false">价格设置</a></li>
            <li><a data-toggle="tab" href="#tab-3" aria-expanded="false">其他设置</a></li>
        </ul>
    </div>
    <div class="modal-body">
        <div class="tab-content rf-auto">
            <div class="tab-pane active" id="tab-1">
                <?= $form->field($model, 'cate_id')->dropDownList($cateDropDownList)->label('产品分类') ?>
                <?php if (empty($model)): ?>
                    <?= $form->field($model, 'code')->textInput(); ?>
                <?php endif; ?>
                <?= $form->field($model, 'code2')->textInput(); ?>
                <?= $form->field($model, 'name')->textInput(); ?>
                <?= $form->field($model, 'name_code')->textInput(); ?>
                <?= $form->field($model, 'rise_fall')->dropDownList(['all' => '全部', 'rise' => '买', 'fall' => '卖'])->label('买卖方向'); ?>
                <?= $form->field($model, 'desc')->textarea(); ?>
                <?= $form->field($model, 'sort')->textInput(); ?>
                <?= $form->field($model, 'on_sale')->radioList(StatusEnum::$listOnSale)->label('上架'); ?>
                <?= $form->field($model, 'status')->radioList(StatusEnum::$listExplain)->label('状态'); ?>
            </div>
            <div class="tab-pane" id="tab-2">
                <?= $form->field($model, 'unit')->textInput()->hint('产品点位单位'); ?>
                <?= $form->field($model, 'unit_price')->textInput()->hint('换算人民币点位单价'); ?>
                <?= $form->field($model, 'unit_step')->textInput()->hint('用户设置止盈止损时，每次增加的最小点位数量'); ?>
                <?= $form->field($model, 'overfee')->textInput(); ?>
                <?= $form->field($model, 'overtime')->textInput(); ?>
                <?= $form->field($model, 'servicefee')->textInput(); ?>
                <?= $form->field($model, 'deposit')->textInput(); ?>
                <?= $form->field($model, 'maxrise')->textInput(); ?>
                <?= $form->field($model, 'minrise')->textInput(); ?>
                <?= $form->field($model, 'maxlost')->textInput(); ?>
                <?= $form->field($model, 'minlost')->textInput(); ?>
            </div>
            <div class="tab-pane" id="tab-3">
<!--                --><?//= $form->field($model, 'lever')->textInput(); ?>
                <?= $form->field($model, 'trade_day')->textInput(); ?>
                <?= $form->field($model, 'trade_time')->textInput(); ?>
                <?= $form->field($model, 'zoom_size')->textInput(); ?>
                <?= $form->field($model, 'contract_size')->textInput(); ?>
                <?= $form->field($model, 'lever_id')->checkboxList($lever);?>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
        <button class="btn btn-primary" type="submit">保存</button>
    </div>
<?php ActiveForm::end(); ?>